package com.yjhb.android.sbz.mvp.reputation;

import com.yjhb.android.sbz.entity.ReputationDetailed;
import com.yjhb.android.sbz.entity.ResultSet;
import com.yjhb.android.sbz.http.HttpObserver;
import com.yjhb.android.sbz.http.HttpTool;
import com.yjhb.android.sbz.mvp.ConventionPresenter;

/**
 * 创建者 zx
 * 创建时间 2021/3/1 16:24
 */
public class ReputationDetailedPresenter extends ConventionPresenter<ReputationDetailedView> {
    private final String TAG = "ReputationDetailedPresenter";

    public ReputationDetailedPresenter(ReputationDetailedView reputationDetailedView) {
        super(reputationDetailedView);
    }

    @Override
    protected void onDestroy() {

    }


    public void getScoreChangeInfo(int size, int current) {
        HttpTool.request(model.getScoreChangeInfo(size, current), new HttpObserver<ResultSet<ReputationDetailed>>() {
            @Override
            public void onResult(ResultSet<ReputationDetailed> data) {
                if (view != null) {
                    if (current == 1) {
                        view.onRefresh(data.getRecords());
                    } else {
                        view.onLoad(data.getRecords());
                    }
                }
            }

            @Override
            public void onError(int code, String msg) {
                if (view != null) {
                    view.onFailure(code, msg);
                }
            }
        });
    }

}
